-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: [DHIS2-18081] Problem with date format when scheduling an event #3816
base: master
Are you sure you want to change the base?
feat: [DHIS2-18081] Problem with date format when scheduling an event #3816
Conversation
src/core_modules/capture-core/utils/converters/date/stringToMomentDateFormat.js
Outdated
Show resolved
Hide resolved
Hey @henrikmv - I like the changes you've made here. However, I think we should keep the |
@@ -45,13 +46,15 @@ export const WidgetEventSchedule = ({ | |||
}); | |||
const { currentUser, noteId } = useNoteDetails(); | |||
const [scheduleDate, setScheduleDate] = useState(''); | |||
const dateFormat = systemSettingsStore.get().dateFormat; | |||
const formatDateForServer = date => moment(date, dateFormat).format('YYYY-MM-DD'); | |||
const formattedScheduleDate = formatDateForServer(scheduleDate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @henrikmv
Can you use existing converters instead, in the same way as is currently done elsewhere, i.e. getConvertedRelatedStageEvent?
const convertFn = pipe(convertFormToClient, convertClientToServer);
const serverScheduleDate = convertFn(scheduleDate, dataElementTypes.DATE);
Thanks!
DHIS2-18081
YYYY-MM-DD
.